//
// Created by ct on 2021/9/16.
//

#include "common.h"

#include    <stdarg.h>        /* ANSI C header file */


void err_sys(const char* fmt,...)
{
  //  printf("hello");
    va_list ap;

    va_start(ap, fmt);
    char buf[MAXLINE];
    vsnprintf(buf, MAXLINE, fmt, ap);

        snprintf(buf+strlen(buf), MAXLINE-strlen(buf), ": %s",
                 strerror(errno));
    strcat(buf, "\n");
    fflush(stdout); /* in case stdout and stderr are the same */
    fputs(buf, stderr);
    fflush(NULL); /* flushes all stdio output streams */
    va_end(ap);
    exit(1);
}



void err_msg(const char* fmt,...){
    printf("err_msg");
}
/* error - print a diagnostic and optionally exit */
void error(int status, int err, char *fmt, ...) {
    va_list ap;

    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
    if (err)
        fprintf(stderr, ": %s (%d)\n", strerror(err), err);
    if (status)
        exit(status);
}



void hello(x,y,z){
    printf("NICUOLE");
}

